package com.demo.controller;

import com.demo.repository.db1.dao.UserMapper;
import com.demo.repository.db1.po.User;
import io.micrometer.core.instrument.Meter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class HelloController {

    private static Logger logger = LoggerFactory.getLogger(HelloController.class);

    @Autowired
    private UserMapper userMapper;

    @RequestMapping("user/{id}")
    public Object getUser(@PathVariable("id") Integer id) {
        User user = userMapper.selectByPrimaryKey(id);
        logger.debug("user id {} : {}", id, user);
        return user;
    }
}
